package com.sdhs.projectschedule.service.impl;

import java.util.List;

import com.sdhs.common.utils.DateUtils;
import com.sdhs.common.utils.SecurityUtils;
import com.sdhs.projectschedule.domain.GcProgressWeeklyReport;
import com.sdhs.projectschedule.mapper.GcProgressWeeklyReportMapper;
import com.sdhs.projectschedule.service.IGcProgressWeeklyReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 项目进度控制--周月报Service业务层处理
 *
 * @author andong
 * @date 2025-03-11
 */
@Service
public class GcProgressWeeklyReportServiceImpl implements IGcProgressWeeklyReportService
{
    @Autowired
    private GcProgressWeeklyReportMapper gcProgressWeeklyReportMapper;

    /**
     * 查询项目进度控制--周月报
     *
     * @param id 项目进度控制--周月报主键
     * @return 项目进度控制--周月报
     */
    @Override
    public GcProgressWeeklyReport selectGcProgressWeeklyReportById(Long id)
    {
        return gcProgressWeeklyReportMapper.selectGcProgressWeeklyReportById(id);
    }

    /**
     * 查询项目进度控制--周月报列表
     *
     * @param gcProgressWeeklyReport 项目进度控制--周月报
     * @return 项目进度控制--周月报
     */
    @Override
    public List<GcProgressWeeklyReport> selectGcProgressWeeklyReportList(GcProgressWeeklyReport gcProgressWeeklyReport)
    {
        return gcProgressWeeklyReportMapper.selectGcProgressWeeklyReportList(gcProgressWeeklyReport);
    }

    /**
     * 新增项目进度控制--周月报
     *
     * @param gcProgressWeeklyReport 项目进度控制--周月报
     * @return 结果
     */
    @Override
    public int insertGcProgressWeeklyReport(GcProgressWeeklyReport gcProgressWeeklyReport)
    {
        gcProgressWeeklyReport.setCreater(SecurityUtils.getUsername());
        gcProgressWeeklyReport.setCreateTime(DateUtils.getNowDate());
        gcProgressWeeklyReport.setCreateTime(DateUtils.getNowDate());
        return gcProgressWeeklyReportMapper.insertGcProgressWeeklyReport(gcProgressWeeklyReport);
    }

    /**
     * 修改项目进度控制--周月报
     *
     * @param gcProgressWeeklyReport 项目进度控制--周月报
     * @return 结果
     */
    @Override
    public int updateGcProgressWeeklyReport(GcProgressWeeklyReport gcProgressWeeklyReport)
    {
        gcProgressWeeklyReport.setUpdater(SecurityUtils.getUsername());
        gcProgressWeeklyReport.setUpdateTime(DateUtils.getNowDate());
        gcProgressWeeklyReport.setUpdateTime(DateUtils.getNowDate());
        return gcProgressWeeklyReportMapper.updateGcProgressWeeklyReport(gcProgressWeeklyReport);
    }

    /**
     * 批量删除项目进度控制--周月报
     *
     * @param ids 需要删除的项目进度控制--周月报主键
     * @return 结果
     */
    @Override
    public int deleteGcProgressWeeklyReportByIds(Long[] ids)
    {
        return gcProgressWeeklyReportMapper.deleteGcProgressWeeklyReportByIds(ids);
    }

    /**
     * 删除项目进度控制--周月报信息
     *
     * @param id 项目进度控制--周月报主键
     * @return 结果
     */
    @Override
    public int deleteGcProgressWeeklyReportById(Long id)
    {
        GcProgressWeeklyReport gcProgressWeeklyReport = gcProgressWeeklyReportMapper.selectGcProgressWeeklyReportById(id);
        gcProgressWeeklyReport.setIsDelete("1");
        return gcProgressWeeklyReportMapper.updateGcProgressWeeklyReport(gcProgressWeeklyReport);
    }
}
